package com.chinadci.smartcommunitysystembackstage.controller;


import com.chinadci.smartcommunitysystembackstage.entity.ScsAdmin;
import com.chinadci.smartcommunitysystembackstage.service.ScsActivityService;
import com.chinadci.smartcommunitysystembackstage.service.ScsLawService;
import com.chinadci.smartcommunitysystembackstage.util.JWTUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Code Duck
 * @since 2021-04-13
 */
@CrossOrigin
@RestController
@Api("建业E家")
public class ScsLawController {
    @Autowired
    private ScsLawService service;

    //显示所有法律宣传
    @ApiOperation(value = "显示所有法律宣传")           //swagger
    //@ApiImplicitParam(name = "scsadmin",value = "对象(电话和密码)")       //表明要传入的参数
    @RequestMapping(value = "/api/flxc",method = RequestMethod.GET)
    public Map Find(){
        Map<String,Object> map=new HashMap<>();
        map.put("data",service.Find());
        return map;
    }

    //查询法律宣传
    @ApiOperation(value = "查询法律宣传")           //swagger
    @ApiImplicitParam(name = "name",value = "发布人姓名")       //表明要传入的参数
    @RequestMapping(value = "/api/cxflxc",method = RequestMethod.GET)
    public Map Find(String name){
        Map<String,Object> map=new HashMap<>();
        map.put("data",service.Find(name));
        return map;
    }

    //根据编号查询法律宣传
    @ApiOperation(value = "根据编号查询法律宣传")           //swagger
    @ApiImplicitParam(name = "id",value = "法律宣传编号")       //表明要传入的参数
    @RequestMapping(value = "/idcxflxc",method = RequestMethod.GET)
    public Map Finds(int id){
        Map<String,Object> map=new HashMap<>();
        map.put("data",service.Finds(id));
        return map;
    }

    //删除指定法律宣传
    @ApiOperation(value = "删除指定法律宣传")           //swagger
    @ApiImplicitParam(name = "id",value = "法律宣传编号")       //表明要传入的参数
    @RequestMapping(value = "/api/scflxc",method = RequestMethod.POST)
    public Map Del(int id){
        Map<String,Object> map=new HashMap<>();
        map.put("data",service.Del(id));
        return map;
    }


}
